<template>
  <button @click="add">按钮</button>
  <p>{{  count }}</p>
</template>

<script setup>

import { ref, defineExpose } from 'vue'
const count = ref(0)

const add = () => {
  count.value++
}

// 需要暴露通过 ref 获取的内容 其他组件获取的
defineExpose({count, add})
</script>

<style lang="scss" scoped>

</style>